function MonthToShowCalculator(repository) {
    this._repository = repository;
}

MonthToShowCalculator.prototype = {
    getTaxYearHeaderStatus: function(yearMonth) {
        var yearMonthToShow = this._getFirstIncompleteMonth(yearMonth) || yearMonth;
        return new CalendarHeaderStatus(yearMonth, yearMonthToShow);
    },
    _getFirstIncompleteMonth: function(yearMonth) {
        var dateRange = new DateRange(yearMonth.firstDayOfMonth(), yearMonth.addMonths(11).lastDayOfMonth());
        var allMonthsInRange = this._repository.getApplicableMonths(dateRange);
        var count = allMonthsInRange.length;
        for (var i = 0; i < count; i++) {
            if (!allMonthsInRange[i].isCompleted()) {
                return allMonthsInRange[i].getYearMonth();
            }
        }
        return null;
    }
};